import request from '@/axios'

export interface Row {
  id: number
  name: string
  pid: number
  status: number
  children: Row[]
  create_time: string
  update_time: string
  delete_time: string | number
}

export interface FormData {
  pid?: number
  id?: number
  name: string
}
// 分类管理列表
export const getListApi = (data: { field: string }): Promise<IResponse> => {
  return request.post({ url: '/goods/cate/select', data })
}
// 分类管理新增
export const createApi = (data: Partial<FormData>): Promise<IResponse> => {
  return request.post({ url: '/goods/cate/create', data })
}
// 分类管理修改
export const modifyApi = (data: Partial<FormData>): Promise<IResponse> => {
  return request.post({ url: '/goods/cate/modify', data })
}
// 分类管理删除
export const delApi = (data: { id: string }): Promise<IResponse> => {
  return request.post({ url: '/goods/cate/del', data })
}
// 分类管理修改状态
export const updateStatusApi = (data: { id: string; status: string }): Promise<IResponse> => {
  return request.post({ url: '/goods/cate/modify_status', data })
}
